home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / gconf.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  4.9 KB  |  158 lines

  1. /* Copyright (C) 1989, 1995, 1996, 1997, 1998, 1999 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: gconf.c,v 1.2 2000/09/19 19:00:11 lpd Exp $ */
  20. /* Configuration tables */
  21. #include "memory_.h"
  22. #include "gx.h"
  23. #include "gscdefs.h"        /* interface */
  24. #include "gconf.h"        /* for #defines */
  25. #include "gxdevice.h"
  26. #include "gxdhtres.h"
  27. #include "gxiclass.h"
  28. #include "gxiodev.h"
  29. #include "gxiparam.h"
  30.  
  31. /*
  32.  * The makefile generates the file gconfig.h, which consists of
  33.  * lines of the form
  34.  *      device_(gs_xxx_device)
  35.  * or
  36.  *      device2_(gs_xxx_device)
  37.  * for each installed device;
  38.  *      emulator_("emulator", strlen("emulator"))
  39.  * for each known emulator;
  40.  *    function_type_(xxx, gs_function_type_xxx)
  41.  * for each known function type;
  42.  *    halftone_(gs_dht_xxx)
  43.  * for each known (device) halftone;
  44.  *    image_class_(gs_image_class_xxx)
  45.  * for each known image class;
  46.  *    image_type_(xxx, gs_image_type_xxx)
  47.  * for each known image type;
  48.  *      init_(gs_xxx_init)
  49.  * for each initialization procedure;
  50.  *      io_device_(gs_iodev_xxx)
  51.  * for each known IODevice;
  52.  *      oper_(xxx_op_defs)
  53.  * for each operator option;
  54.  *      psfile_("gs_xxxx.ps", strlen("gs_xxxx.ps"))
  55.  * for each optional initialization file.
  56.  *
  57.  * We include this file multiple times to generate various different
  58.  * source structures.  (It's a hack, but we haven't come up with anything
  59.  * more satisfactory.)
  60.  */
  61.  
  62. /* ---------------- Resources (devices, inits, IODevices) ---------------- */
  63.  
  64. /* Declare devices, image types, init procedures, and IODevices as extern. */
  65. #define device_(dev) extern gx_device dev;
  66. #define device2_(dev) extern const gx_device dev;
  67. #define halftone_(dht) extern DEVICE_HALFTONE_RESOURCE_PROC(dht);
  68. #define image_class_(cls) extern iclass_proc(cls);
  69. #define image_type_(i,type) extern const gx_image_type_t type;
  70. #define init_(proc) extern init_proc(proc);
  71. #define io_device_(iodev) extern const gx_io_device iodev;
  72. #include "gconf.h"
  73. #undef io_device_
  74. #undef init_
  75. #undef image_type_
  76. #undef image_class_
  77. #undef halftone_
  78. #undef device2_
  79. #undef device_
  80.  
  81. /* Set up the device table. */
  82. #define device_(dev) (const gx_device *)&dev,
  83. #define device2_(dev) &dev,
  84. private const gx_device *const gx_device_list[] = {
  85. #include "gconf.h"
  86.      0
  87. };
  88. #undef device2_
  89. #undef device_
  90.  
  91. /* Set up the (device) halftone table. */
  92. extern_gx_device_halftone_list();
  93. #define halftone_(dht) dht,
  94. const gx_dht_proc gx_device_halftone_list[] = {
  95. #include "gconf.h"
  96.     0
  97. };
  98. #undef halftone_
  99.  
  100. /* Set up the image class table. */
  101. extern_gx_image_class_table();
  102. #define image_class_(cls) cls,
  103. const gx_image_class_t gx_image_class_table[] = {
  104. #include "gconf.h"
  105.     0
  106. };
  107. #undef image_class_
  108. /* We must use unsigned here, not uint.  See gscdefs.h. */
  109. const unsigned gx_image_class_table_count = countof(gx_image_class_table) - 1;
  110.  
  111. /* Set up the image type table. */
  112. extern_gx_image_type_table();
  113. #define image_type_(i,type) &type,
  114. const gx_image_type_t *const gx_image_type_table[] = {
  115. #include "gconf.h"
  116.     0
  117. };
  118. #undef image_type_
  119. /* We must use unsigned here, not uint.  See gscdefs.h. */
  120. const unsigned gx_image_type_table_count = countof(gx_image_type_table) - 1;
  121.  
  122. /* Set up the initialization procedure table. */
  123. extern_gx_init_table();
  124. #define init_(proc) proc,
  125. const gx_init_proc gx_init_table[] = {
  126. #include "gconf.h"
  127.     0
  128. };
  129. #undef init_
  130.  
  131. /* Set up the IODevice table.  The first entry must be %os%, */
  132. /* since it is the default for files with no explicit device specified. */
  133. extern_gx_io_device_table();
  134. extern gx_io_device gs_iodev_os;
  135. #define io_device_(iodev) &iodev,
  136. const gx_io_device *const gx_io_device_table[] = {
  137.     &gs_iodev_os,
  138. #include "gconf.h"
  139.     0
  140. };
  141. #undef io_device_
  142. /* We must use unsigned here, not uint.  See gscdefs.h. */
  143. const unsigned gx_io_device_table_count = countof(gx_io_device_table) - 1;
  144.  
  145. /* Return the list of device prototypes, a NULL list of their structure */
  146. /* descriptors (no longer used), and (as the value) the length of the lists. */
  147. extern_gs_lib_device_list();
  148. int
  149. gs_lib_device_list(const gx_device * const **plist,
  150.            gs_memory_struct_type_t ** pst)
  151. {
  152.     if (plist != 0)
  153.     *plist = gx_device_list;
  154.     if (pst != 0)
  155.     *pst = NULL;
  156.     return countof(gx_device_list) - 1;
  157. }
  158.